﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics.Contracts;

namespace Numero3DBObject
{
    [Serializable()]
    public class Resultat
    {
        private string matricule;
        private string sigle;
        private string cote;

        public Resultat() { }

        public Resultat(string _etudiant, string _cours, string _cote)
        {
            matricule = _etudiant;
            sigle = _cours;
            cote = _cote;
        }

        public string Matricule
        {
            get { return matricule; }
            set { matricule = value; }
        }


        public string Sigle
        {
            get { return sigle; }
            set { sigle = value; }
        }


        public string Cote
        {
            get { return cote; }
            set { cote = value; }
        }

        public static bool operator ==(Resultat r1, Resultat r2)
        {
            try
            {
                bool identique = false;
                if( r1.Matricule.Equals(r2.Matricule)
                    && r1.Sigle.Equals(r2.Sigle)
                    && r1.Cote.Equals(r2.Cote))
                {
                    identique = true;
                }

                return identique;
            }
            catch (NullReferenceException e)
            {
                
                throw e;
            }

        }

        public static bool operator !=(Resultat r1, Resultat r2)
        {        
            try 
	        {	        
		        bool different = false;
                if (!(r1.Matricule.Equals(r2.Matricule)
                    && r1.Sigle.Equals(r2.Sigle)
                    && r1.Cote.Equals(r2.Cote)))
                {
                    different = true;
                }

                return different;
	        }
	        catch (NullReferenceException e)
	        {
		
		        throw e;
	        }

        }


        public override bool Equals(object obj)
        {
            return base.Equals(obj);
        }

        public override int GetHashCode()
        {
            return base.GetHashCode();
        }
    }
}
